<script setup lang="ts">
import {NOTICE_TYPE} from "~/const/Maps";

definePageMeta({
  layout:'admin',
  title:'公告列表',
});
const route=useRoute();
const form=reactive({
  limit:20,
  page:1,
  type:route.query.type as string||'10',
});
const {data:list,refresh}=await useServerGet('/notice/getList',form)
</script>
<template>
<div>
  <el-card class="mt-4">
    <el-table :data="list.data.list" style="width: 100%" :header-cell-style="{'text-align':'center'}" :cell-style="{'text-align':'center'}">
      <el-table-column prop="id" label="ID" width="80"></el-table-column>
      <el-table-column prop="title" label="标题"></el-table-column>
      <el-table-column prop="updated_at" label="更新时间" ></el-table-column>
      <el-table-column prop="created_at" label="创建时间" ></el-table-column>
      <el-table-column label="内容">
        <template #default="{row}">
          <div class="flex">
            <div class="line-clamp-2">{{row.synopsis}}</div>
            <NuxtLink :to="`/noticeDetail/${row.id}.html`" target="_blank" class="line-clamp-2"><span class="text-blue-400 ml-0.5">点击查看</span></NuxtLink>
          </div>

        </template>
      </el-table-column>
      <el-table-column prop="type" label="类型">
        <template #default="{row}">
          <span>{{NOTICE_TYPE[row.type]}}</span>
        </template>
      </el-table-column>
    </el-table>
    <MyPage v-model:page="form.page" v-model:perpage="form.limit" v-model:total="list.data.total" @change="refresh"></MyPage>
  </el-card>
</div>
</template>

<style scoped lang="scss">

</style>